<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        li {
            list-style-type: none;
        }
        
        .box {
            width: 250px;
            margin: 100px auto;
        }
        
        .box li {
            float: left;
            width: 24px;
            height: 24px;
            background-color: pink;
            margin: 15px;
            background: url(images/sprite.png) no-repeat;
        }
    </style>
</head>

<body>
    <div class="box">
        <ul>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
    </div>
    <script>
        var lis = document.querySelectorAll('.box li');
        for (var i = 0; i < lis.length; i++){
            //lis[i] 每一个li
            // lis[i].style.backgroundPosition = '0 ' + (-i*44) +'px';
            //模板字符串:英文输入法 按tab上面的波浪线 ````
            // `字符{变量}字符字符`
            lis[i].style.backgroundPosition = `0 -${i*44}px`;
        }
    </script>
</body>
</html>